Dapple is a Solidity developer multitool designed to manage the growing complexity of interconnected smart contract systems.
Its core functionality encompasses three main areas:
- Package management
- Contract building
- Deployment scripting
These concepts are related in a way unique to the smart contract ecosystem, due to each blockchain's universal singleton nature.
The central data model for Dapple is the dappfile, whose definition
will normally reference IPFS objects and Ethereum contract addresses.
The normal way to install Dapple is through npm:
$ npm install -g dapple
$ dapple --help
If you're on Ubuntu 14.04 or above and don't have Node.js or the Solidity compiler, try following these steps to install them:
Install Node.js:
apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_6.x | bash
apt-get update
apt-get install -y nodejs
Install Solidity:
apt-get install -y software-properties-common
add-apt-repository ppa:ethereum/ethereum
add-apt-repository ppa:ethereum/ethereum-qt
apt-get update
apt-get install -y cpp-ethereum
Install Dapple:
apt-get install -y git build-essential python
git clone https://github.com/nexusdev/dapple
cd dapple
npm link
If you can't or don't want to install Dapple and the Solidity compiler
on your host machine, you can use the dapple-docker wrapper script
to run the whole toolchain inside a Docker container. This script can
be used instead of dapple but must be installed separately:
$ make docker-install
$ dapple-docker help
The current directory is automatically mounted into the containers. Note: If you're on OS X, this only works in your home directory.
Use dapple init to generate a project skeleton:
mkdir foo; cd foo; dapple init
By default, build/ is where the output of dapple build gets put,
and contracts/ is where Dapple looks for your contract source files.
Both of these are configured in your dappfile and can be overridden.
Now try writing a contract and a test (see Dapple test harness docs):
$ vim contracts/dapp.sol
$ vim contracts/dapp_test.sol
$ dapple test
Finally, try building your project:
$ dapple build
By default, dapple build builds the entire contracts/ tree, and
emits the following:
- cached build objects
classes.json— a list of type definitionsjs_module.js— a JavaScript module which wrapsclasses.jsonand addsContractobjects instantiated fromweb3.jsfor each object in thedappfile
If you are using TestRPC, remember that dapple run has a default block
confirmation time of one block. To prevent a deadlock you need to turn off the
confirmation time testrpc environment:
environments:
test:
confirmationBlocks: 0
- Dappsys — a contract system framework (Nexus's "standard library")
- Feedbase — a simple paid feed app
- stringutils — string manipulation library
- Basic VM tests
- Testing exceptions
- Testing events
- Installing and publishing packages
- Deployment scripting
- Logging
- Aliasing and imports
- Environments and object linking
- Ignore/add
