This documentation is deprecated. Please use our new technical documentation.
- Getting started developing for OP Mainnet
- Writing your first contract on OP Mainnet (or OP Goerli) - if you are just getting started with blockchain development
Build your first app on Optimism!
This documentation is deprecated. Please use our new technical documentation.
in readme
the step below
git clone [email protected]:ethereum-optimism/optimism.git
cd optimism
yarn
yarn build
docker-compose build # need to specify the compose file or just cd ops dir
docker-compose up
In README we have a bit
Ethereum are required to replace certain EVM opcodes with custom behavior.
What would be the source material for this to know what actually happens here? Would be nice to link from README, so the reader does not need to guess.
Describe the bug
I get an error when I docker-compose up
.
It seems to be a versioning issue, is there a solution?
output is
% docker-compose up
WARN[0000] The L1CHAIN_HTTP_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The DEPLOYER_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The DTL_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The L2GETH_HTTP_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The L2GETH_WS_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The VERIFIER_HTTP_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The VERIFIER_WS_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The L2GETH_HTTP_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The L2GETH_WS_PORT variable is not set. Defaulting to a blank string.
WARN[0000] The DATA_TRANSPORT_LAYER__ADDRESS_MANAGER variable is not set. Defaulting to a blank string.
WARN[0000] The DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT variable is not set. Defaulting to a blank string.
WARN[0000] The DATA_TRANSPORT_LAYER__L2_CHAIN_ID variable is not set. Defaulting to a blank string.
WARN[0000] The DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT variable is not set. Defaulting to a blank string.
WARN[0000] The ADDRESS_MANAGER_ADDRESS variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_STATE_DUMP_PATH variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_CTC_DEPLOYMENT_HEIGHT variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_CLIENT_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_CLIENT_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_CTC_DEPLOYMENT_HEIGHT variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_STATE_DUMP_PATH variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_CLIENT_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_HTTP variable is not set. Defaulting to a blank string.
WARN[0000] The ROLLUP_STATE_DUMP_PATH variable is not set. Defaulting to a blank string.
WARN[0000] The ETH1_CTC_DEPLOYMENT_HEIGHT variable is not set. Defaulting to a blank string.
panic: runtime error: index out of range [0] with length 0
goroutine 62 [running]:
github.com/docker/compose-cli/pkg/compose.(*convergence).updateProject(0xc00000cf00, 0xc0004161e0, 0xc0002f6048, 0x11)
github.com/docker/compose-cli/pkg/compose/convergence.go:114 +0xfcf
github.com/docker/compose-cli/pkg/compose.(*convergence).apply.func1(0x20d6548, 0xc0000b1da0, 0xc0002f6048, 0x11, 0x0, 0x0)
github.com/docker/compose-cli/pkg/compose/convergence.go:104 +0x292
github.com/docker/compose-cli/pkg/compose.run.func1(0x0, 0x0)
github.com/docker/compose-cli/pkg/compose/dependencies.go:102 +0xa3
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0003b3a10, 0xc00008d380)
golang.org/x/[email protected]/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
golang.org/x/[email protected]/errgroup/errgroup.go:54 +0x66
System Specs:
On this page: https://github.com/ethereum-optimism/optimism-tutorial/tree/main/standard-bridge-custom-token
At the very bottom:
Link is broken ☝️
Describe the bug
I have attempted at the l1-l2-deposit-withdrawal
example, but I get the following error when I run the scripts/example.js
by harhat.
Error: call revert exception (method="getAddress(string)", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.4.0)
at Logger.makeError (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/logger/src.ts/index.ts:213:28)
at Logger.throwError (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/logger/src.ts/index.ts:225:20)
at Interface.decodeFunctionResult (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
at Contract.<anonymous> (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/contracts/src.ts/index.ts:332:44)
at step (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (/Users/zhanhaozhao/Documents/repositories/optimism-tutorial/l1-l2-deposit-withdrawal/node_modules/@ethersproject/contracts/lib/index.js:20:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'getAddress(string)',
errorArgs: null,
errorName: null,
errorSignature: null,
address: '0x4200000000000000000000000000000000000008',
args: [ 'OVM_L1CrossDomainMessenger' ],
transaction: {
data: '0xbf40fac10000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a4f564d5f4c3143726f7373446f6d61696e4d657373656e676572000000000000',
to: '0x4200000000000000000000000000000000000008'
}
}
Did I miss something? 🤔️
To Reproduce
l1-l2-deposit-withdrawal
& install dependenciesnpx hardhat node
npx hardhat run ./scripts/example.js --network localhost
Expected behavior
No error and working fine.
Is your feature request related to a problem? Please describe.
It takes a long time to do the docker-compose build
step, as you acknowledge in the doc:
Now we just need to download, build, and install our Optimistic Ethereum node by running the following commands. Please note that docker-compose build will take a while. We're working on improving this (sorry)!
Describe the solution you'd like
Put a docker image on a registry.
I noticed there are a couple of broken links in the optimism-tutorial repo that needs to be fixed.
I followed the instructions to create a local Optimism network. Basically, I checked out the Optimism monorepo and ran the the following under the ops
folder:
docker-compose up -d
I connected to the L1 hardhat network and saw the default 20 accounts (each with 5000ETH). I created a smart contract on the L1 network by connecting to port 9454 directly. Things worked all fine with the L1 network.
However, when I tried to create a smart contract on the L2geth network, I ran into the following error:
reason: 'insufficient funds for intrinsic transaction cost',
code: 'INSUFFICIENT_FUNDS',
error: ProviderError: invalid transaction: insufficient funds for gas * price + value
at HttpProvider.request (/Users/jou2019/workspace/hello-world/node_modules/hardhat/src/internal/core/providers/http.ts:74:19)
at GanacheGasMultiplierProvider.request (/Users/jou2019/workspace/hello-world/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:312:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5),
method: 'sendTransaction',
When I looked at the accounts and fund of the L2geth network, I saw a single account there (0x00000398232e2064f896018496b4b44b3d62751f
in my case) with 0ETH.
Not sure if that is a bug or not. The instructions seem to indicate the 20 L1 test accounts should be created for both L1 and L2 with funds. Or maybe that single account with 0 fund is expected. I cannot find instructions how to move forward to "create" fund myself on the L2 network. Wonder if anyone can give me some help on how to move forward. Thanks a lot in advance.
I am unable to run the x-chain tests, getting this error:
1) Layer 1 <> Layer 2 ERC20 Transfers
"before each" hook for "should do the full flow":
TypeError: Cannot read property 'L1CrossDomainMessenger' of undefined
at /Users/Georgios/paradigm/portfolio/optimism/optimism-tutorial/test/erc20-xdomain.spec.ts:118:112
at step (test/erc20-xdomain.spec.ts:52:23)
at Object.next (test/erc20-xdomain.spec.ts:33:53)
at /Users/Georgios/paradigm/portfolio/optimism/optimism-tutorial/test/erc20-xdomain.spec.ts:27:71
at new Promise (<anonymous>)
at __awaiter (test/erc20-xdomain.spec.ts:23:12)
at Context.<anonymous> (test/erc20-xdomain.spec.ts:115:37)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Steps to reproduce:
git clone https://github.com/ethereum-optimism/optimism-tutorial/
cd optimism-tutorial
git checkout dev-xdomain
yarn
yarn compile
yarn test
This is an issue because l2ethers.contracts
is undefined. Was it refactored somewhere?
when run
crossChainMessenger = new optimismSDK.CrossChainMessenger({ l1ChainId: 42, // For Kovan, it's 1 for Mainnet l1SignerOrProvider: l1Signer, l2SignerOrProvider: l2Signer, });
throw
Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.6.2)
Hi team,
I am not able to understand that if the internal transaction is affecting the account balance of optimism? If yes, then how?
The tutorial points to optimismfaucet.xyz, that faucet does not exist anymore.
Describe the bug
That web page should direct to this tutorial.
To Reproduce
Expected behavior
I'd expect the link to lead to this tutorial.
Screenshots
Describe the bug
ETH balances for L2 accounts return zero balances when instantiated with either hardhat's default list of accounts, or the private keys of the local deployer and sequencer addresses.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
We should have starting L2 ETH balances for accounts.
Screenshots
Additional context
This issue arose from several upgrades to Optimism repositories in use by optimism-integration
.
Thus, the Waffle-ERC20-Example and Truffle-ERC20-Example repositories are also broken with this same bug.
Describe the bug
yarn install
fails with this error:
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "ethereum-waffle > @ethereum-waffle/compiler > typechain > [email protected]" has unmet peer dependency "typescript@>=3.7.0".
warning " > [email protected]" has unmet peer dependency "@ethersproject/hardware-wallets@^5.0.14".
[4/4] Building fresh packages...
Done in 75.79s.
And afterwards you can't progress because npx hardhat <anything>
also fails:
An unexpected error occurred:
Error: Cannot find module '@eth-optimism/hardhat-ovm'
Require stack:
- /home/qbzzt1/optimism-tutorial/hardhat.config.js
- /home/qbzzt1/optimism-tutorial/node_modules/hardhat/internal/core/config/config-loading.js
- /home/qbzzt1/optimism-tutorial/node_modules/hardhat/internal/cli/cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/qbzzt1/optimism-tutorial/hardhat.config.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/qbzzt1/optimism-tutorial/hardhat.config.js',
'/home/qbzzt1/optimism-tutorial/node_modules/hardhat/internal/core/config/config-loading.js',
'/home/qbzzt1/optimism-tutorial/node_modules/hardhat/internal/cli/cli.js'
]
}
To Reproduce
git clone https://github.com/ethereum-optimism/optimism-tutorial
cd optimism-tutorial
yarn install
Expected behavior
The expected behavior is for the HardHat build process to succeed
System Specs:
Linux optimism 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux
Describe the bug
Tutorial broken with @eth-optimism/plugins version currently installed when following the instructions. Using an older version, e.g. yarn add @eth-optimism/[email protected]
runs into #8 instead
To Reproduce
Steps to reproduce the behavior: follow the tutorial - the testing again step fails with
Error: Cannot find module '@eth-optimism/plugins/hardhat/ethers'
Expected behavior
All tutorial steps working
Additional context
ethereum-optimism/plugins#31 seems to have caused it
Hello, been following this tutorial https://github.com/ethereum-optimism/optimism-tutorial and everything runs smoothly until the part where I have to run docker-compose build command inside ops folder. I also tried install the packages with yarn install --force , but without any result.
My yarn version is 1.10.1.
Attaching screenshot of the error I'm stuck at:
https://ibb.co/25qBxdz
As shown in the screenshot, the first errors appears at @eth-optimism/contracts package.
This link:
https://github.com/ethereum-optimism/optimism-tutorial/tree/main/l1-l2-deposit-withdrawal
in the readme is broken. It seems that directory no longer exists on main
branch anymore.
I am not sure if its the correct channel please excuse me.
Hello Team,
I am Cyril Naves, a doctoral student of university cote d 'azur and I am working on blockchain consensus for private networks.
I would like to ask you some questions as part of my thesis work, please.
I am interested in building a private network with optimism. My questions are:
Can optimism be used to create private networks locally? If yes can you please point me to a tutorial?
Can smart contract be deployed on optimism local private network? If yes can you please point me to the tutorial please?
What is consensus supported by optimism it is Proof of work or Proof of Authority like in Ethereum?
Also can you let me know the TPS measured in optimistic ethereum if you had tested?
Thanks for your help,
Cyril
Is there a web3 python project that covers the same calls?
L2 => L1 transaction on miannet must wait 7 days and on Kovan it's 60s, on optimism local network it also should a short time.
but is hangs when waiting to be relayed to L1.
Steps to reproduce :
docker-compose -f docker-compose-nobuild.yml up -t 3600
node scripts/example.js
output:
Deploying L1 ERC20...
L1_ERC20 deployed @ 0x3Aa...c
Deploying L2 ERC20...
L2_ERC20 deployed @ 0x5Fb...3
Instantiate L1 Standard Bridge...
Balance on L1: 1234
Balance on L2: 0
Approving tokens for Standard Bridge...
Depositing tokens into L2 ...
Waiting for deposit to be relayed to L2...
Balance on L1: 0
Balance on L2: 1234
Withdrawing tokens back to L1 ...
Waiting for withdrawal to be relayed to L1...
(...freeze...)
Describe the bug
A clear and concise description of what the bug is.
Followed instructions in Step:1 of the The Official™ Optimism Tutorial https://github.com/ethereum-optimism/optimism-tutorial. Compiled Solidity into EVM bytecode without any issues and then moved onto compiling an Optimistic Ethereum contract with the command TARGET=ovm npx hardhat compile
which throws an ERROR: 'TARGET' is not recognized as an internal or external command,operable program or batch file.
To Reproduce
Steps to reproduce the behavior:
TARGET=ovm npx hardhat compile
at the end of step 6 to complete'TARGET' is not recognized as an internal or external command,operable program or batch file.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
System Specs:
Additional context
Add any other context about the problem here.
Standard-Bridge-Standard-Token
Following the README, if you setup a script as standard-bridge-standard-token/scripts/deploy.js
, then following through the tutorial then you can reach the end successfully.
Standard-Bridge-Custom-Token
Following the README, if you setup a script as standard-bridge-custom-token/scripts/deploy.js
, then following through the tutorial you encounter an HttpProvider
error because the .env variables are not getting loaded in until you add require('dotenv').config()
to the top of the file.
We should standardize this process and make it not work in either tutorial until adding require('dotenv').config()
or have both tutorials automatically inject it (exactly how it works in standard-bridge-standard-token).
I am not sure of the solution, therefore I am making an issue. However, going to investigate to see if I can inject it into standard-bridge-custom-token, given the time.
In a recent commit docker-compose-nobuild.yml
was removed so the instruction on running a local node don't work.
change
docker-compose -f docker-compose-nobuild.yml up -t 3600
to
docker-compose -f docker-compose.yml up -t 3600
in tutorials README, at "Start an Optimistic Ethereum Node" paragraph.
following the tutorial, on testing you get
should revert when the sender does not have enough balance:
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":104,\"error\":{\"code\":-32000,\"message\":\"gas required exceeds allowance (9000000) or always failing transaction\"}}\n","error":{"code":-32000},"requestBody":"{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0x0\",\"from\":\"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266\",\"to\":\"0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9\",\"data\":\"0xa9059cbb00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c800000000000000000000000000000000000000000000000000000000000f4241\"}],\"id\":104,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"http://localhost:8545"},"method":"estimateGas","transaction":{"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","gasPrice":{"type":"BigNumber","hex":"0x00"},"to":"0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9","data":"0xa9059cbb00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c800000000000000000000000000000000000000000000000000000000000f4241","accessList":null}}, tx={"data":"0xa9059cbb00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c800000000000000000000000000000000000000000000000000000000000f4241","to":{},"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","gasPrice":{},"nonce":{},"gasLimit":{},"chainId":{}}, code=UNPREDICTABLE_GAS_LIMIT, version=abstract-signer/5.1.0)
Forked the tutorial here and followed the steps according to readme.
https://github.com/danoctavian/optimism-tutorial/tree/13391946ef39cbed13897b9193980ba0249ecb8b
OS: macos: 10.15.7
yarn version: 1.22.10
node version: v10.23.0
npm version: 6.14.8
yarn test
fails with:
Optmistic ERC20
the basics
1) "before each" hook for "should have a name"
8 passing (1s)
1 failing
1) Optmistic ERC20
"before each" hook for "should have a name":
Error: Transaction reverted without a reason
at <UnrecognizedContract>.constructor (unknown)
at process._tickCallback (internal/process/next_tick.js:68:7)
```
Inspired by the hardhat and truffle tutorials, I believe that there should be a basic tutorial on how to get started with Dapptools for Optimism.
The watcher hasn't been maintained for months, switching over to core utils would be a better example for devs.
The GitHub link in your default issue text is expired:
This repository only accepts issues related to the documentation here https://github.com/ethereum-optimism/optimism-tutorial
If you have a support problem, [join our discord](https://discord.gg/C8CjvkaU4w) and post it in the appropriate channel, either `#user-support` or `#dev-support`.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.