diff --git a/docs.wrm/getting-started.wrm b/docs.wrm/getting-started.wrm index 7a4fd30ad..64d16d531 100644 --- a/docs.wrm/getting-started.wrm +++ b/docs.wrm/getting-started.wrm @@ -1,29 +1,29 @@ _section: Getting Started @ @priority<100> -This -The v6 getting started is coming soon... +This is a very short introduction to Ethers, but covers many of the +most common operations that developers require and provides a +starting point for those newer to Ethereum. -_heading: Installing -_code: Install via NPM @lang - # Create a new folder for your project - /home/ricmoo> mkdir test-ethers - /home/ricmoo> cd test-ethers +_heading: Getting Ethers +If using NPM, you must first install Ethers. + +_code: installing via NPM @lang # Install ethers - /home/ricmoo/test-ethers> npm install ethers@beta-exports + /home/ricmoo/test-ethers> npm install ethers@beta -_heading: Importing +_null: -Everything in Ethers is exported at the root as well as on the ``ethers`` +Everything in Ethers is exported from its root as well as on the ``ethers`` object. There are also ``exports`` in the ``package.json`` to facilitate -sub-packages. +more fine-grained importing. Generally this documentation will presume all exports from ethers have been imported in the code examples, but you may import the necessary objects any way you wish. -_code: Node.js @lang -_subsection: Some Common Terminology +_subsection: Some Common Terminology @ -_heading: PROVIDER +To begin, it is useful to have a basic understanding of the types of +objects available and what they are responsible for, at a high level. -_heading: SIGNER +_heading: Provider -_heading: TRANSACTION +A [[Provider]] is a read-only connection to the blockchain, which allows +querying the blockchain state, such as accout, block or transaction details, +querying event logs or evaluating read-only code using call. + +If you are coming from Web3.js, you are used to a **Provider** offering +both read and write access. In Ethers, all write operations are further +abstracted into another Object, the **Signer**. + +_heading: Signer + +A [[Signer]] wraps all operations that interact with an account. An +account generally has a private key located //somewhere//, which can be +used to sign a variety of types of payloads. + +The private key may be located in memory (using a [[Wallet]]) or +protected via some IPC layer, such as MetaMask which proxies interaction +from a website to a browser plug-in, which keeps the private key out of +the reach of the website and only permits interaction after requesting +permission from the user and receiving authorization. + +_heading: Transaction + +To make any state changes to the blockchain, a transaction is required, +which requires a fee be paid, where the fee covers the associated costs +with executing the transaction (such as reading the disk and performing +maths) and storing the updated information. + +If a transaction reverts, a fee must still be paid, since the validator +still had to expend resources to try running the transaction to determine +that it reverted and the details of its failure are still be recorded. + +Transactions include sending ether from one user to another, deploying +a **Contract** or executing a state-changing operation against a +**Contract**. + +_heading: Contract + +A [[Contract]] is a program that has been deployed to the blockchain, +which includes some code and has allocated storage which it can read +from and write to. + +It may be read from when it is connected to a [[Provider]] or +state-changing operations can be called when connected to a [[Signer]]. _heading: Receipt -_heading: CONTRACT +Once a **Transaction** has been submitted to the blockchain, it is placed +in the memory pool (mempool) until a validator decides to include it. + +A transaction's changes are only made once it has been included in the +blockchain, at which time a receipt is available, which includes details +about the transaction, such as which block it was included in, the actual +fee paid, gas used, all the events that it emitted and whether it was +successful or reverted. +_subsection: Connecting to Ethereum @ -_subsection: Connecting to Ethereum +This very first thing needed to begin interacting with the blockchain is +connecting to it using a [[Provider]]. _heading: MetaMask (and other injected providers) @@ -107,7 +159,7 @@ When using your own Ethereum node or a developer-base blockchain, such as Hardhat or Ganache, you can get access the accounts with [[JsonRpcProvider-getSigner]]. -_code: @lang