- Native or
- Windows 10 Ubuntu subsystem or
- Use vagrant:
- Download and install https://virtualbox.org and https://vagrantup.com,
- Execute in a directory where the vagrant should be stored:
- Initialise the vagrant:
- Use forgae.box with everything pre-installed:
- Copy forgae.box to the directory, then
vagrant init forgae.box
, or vagrant init utu/forgae
which downloads the box from vagrantup.com, or
- Copy forgae.box to the directory, then
- Use generic Ubuntu 18 box:
vagrant init ubuntu/bionic64
- Use forgae.box with everything pre-installed:
vagrant up
vagrant ssh
- If forgae.box or utu/forgae was used, skip the rest of this section and continue with Create a Wallet.
- Initialise the vagrant:
- Execute
sudo apt update
- Install
- git:
apt install git
- node.js and npm:
apt install npm
- git:
git clone https://github.com/aeternity/aepp-cli-js.git
cd aepp-cli-js
sudo npm link
npm i -g forgae
- Create and initialise a project:
mkdir aepp1; cd aepp1
forgae init
- See also https://dev.aepps.com/tutorials/smart-contract-deployment-in-forgae.html
Execute all of the following inside the vagrant. We will use a wallet, also known as "account", called "a1". Note that this is just a local name, you can name it whatever you want.
Also note that we're using the testnet (-u https://sdk-testnet.aepps.com); there's also a docker compose configuration file in the initialised forgae project (aepp1) which can be used to run a local test net with 3 nodes. Docker and docker-compose are installed in the pre-built box (forgae.box), but the vagrant's configuration might need to be changed to have more memory available for this.
aecli account -u https://sdk-testnet.aepps.com create a1
(Set a password or just press enter)
=>
Address___ak…
Path______/home/vagrant/a1
aecli account -u https://sdk-testnet.aepps.com balance a1
=>
API ERROR: Account not found
- Open https://testnet.faucet.aepps.com
- Copy-paste your wallet address above
- Wait for tx…
aecli account -u https://sdk-testnet.aepps.com balance a1
=>
Balance___5000000000000000000
ID________ ak_…
Nonce____1
aecli account address a1 --privateKey
(Enter password + confirm)
=>
Secret Key_____…
From the forgae project readme:
ForgAE is an aeternity framework which helps with setting up a project. The framework makes the development of smart contracts in the aeternity network pretty easy. It provides commands for compilation, deployment of smart contracts, running a local node and unit testing the contracts.
We will use it for those purposes, but note that smart contract compilation, deployment and calling can also be done using just the command line tools (aecli). To find out more, use
aecli -h
,aecli <command> -h
,- etc.
Execute the following commands inside the forgae project folder (aepp1). Contracts are in the "contracts" subdirectory. The compile and deploy commands process all contracts present in that directory.
Compilation of a contract connects to an AE node to compile the contract and obtain the byte code, but it will not be deployed yet. The bytecode is what will actually be deployed on the chain.
Compilation is mainly useful for
- testing whether a contract compiles correctly, or if not, get the compiler errors, and for
- confirming that a given source code compiles to a given byte code, e.g. to verify that a deployed contract matches a given source code.
forgae compile -n testnet
===== Compiling contracts =====
Contract '/home/vagrant/aepp1/contracts/HelloWorld.aes has been successfully compiled'
Contract bytecode: cb_…
If the contract compiles correctly, it can be deployed:
forgae deploy -n testnet -s <secretKey>
===== Contract: ExampleContract.aes has been deployed =====
Your deployment script finished successfully!
To start development on your aepp proper in Javascript, refer to the forgae documentation.
Links
- https://dev.aepps.com
- https://dev.aepps.com/tutorials/README.html
- https://forum.aeternity.com
- https://github.com/aeternity/aepp-forgae-js
- Visual Studio Code extension for Sophia (If using vagrant, edit your Vagrantfile to sync a folder on the host system to folder inside the vagrant, or move the aepp1 folder to /vagrant which is synced to the folder where the Vagrantfile is).