How to deploy locally to ganache (be sure to have ganache-cli installed globally)
- Run
yarn ganache
in one terminal - Run
yarn truffle
in another terminal to deploy the contracts - Run
yarn load-powergate-data
as soon as the contracts finish deploying in the last terminal - Run
yarn start-cron
in an extra 3rd terminal to start the cron job - Run
cd app && yarn start
in a 4th end to start the front end. It will be available on localhost:4000
Prerequisites:
- Docker Desktop and Docker Compose
- Golang
Instalation (more in depth in https://docs.textile.io/powergate/localnet/):
git clone git@github.com:textileio/powergate.git
cd powergate/docker
BIGSECTORS=true make localnet
If there are errors at this point, such as "powd/main.go:66 starting server: connecting to lotus node: resolving dns: lookup lotus on 127.0.0.11:53: no such host localnet_powergate_1 exited with code 1" OR SIGINT errors, you should try to build the lotus image by yourself:
git clone https://github.com/textileio/lotus-devnet.git
git checkout ntwk-calibration-x.x.x
(substitute x x x for the latest release branch)docker build -t my-local-devnet .
In the Powergate repo, replace in docker/docker-compose-localdevnet.yaml, the textile/local-devnet:.. for my-local-devnet.
When complete, you will have a fully functional Powergate (powd), a Lotus localnet, and an IPFS node wired correctly together to start using. To install the CLI:
make build-pow
- Check the instalation with
pow --help
We are designing a sustainability-linked bond in Solidity, to enable the issuance and repayment of a corporate or government bond on Ethereum. Blockchain bonds hold promise to offer significant savings in the cost of issuance and administration. Our aim is to link the bond structure to sustainability metrics submitted by an off-chain oracle, which is analyzing measurements of ecological health.
The bond contract must be adapted so that the borrower (i.e. government or corporate entity) is financially incentivized to meet sustainability targets. In our case - a simple prototype to illustrate the capability - we imagine the Greater London Authority issuing a sustainability-linked municipal bond.
In this scenario, the GLA wants to raise 1000 ether. They issue 1000 bonds with a face value of 1 ETH.
From the investor's perspective, it is a fixed-income instrument: they are paid a coupon rate of 3% of the bond's face value (i.e. 0.03 ETH) each year for 10 years, then are repaid the full face value once the bond matures.
This means that each year the GLA must pay 30 ether into the contract to repay bond holders.
However, we also want to incentivize the GLA to improve air quality in London. We will do this by linking the repayment amount to measurements of air quality, which will be calculated and submitted on an annual basis by an oracle. In this simple example, we are finding the average NOx level across London based on data generated by DEFRA, the UK Department for Environment, Food and Rural Affairs. (We will leave aside the possibility of collusion between DEFRA and the GLA for now - though this points to the importance of carefully designing the game theory of decentralized spatial finance products.)
In addition to the money repaid annually to pay bond coupons, the bond is designed so the Greater London Authority is required to pay an additional amount, based on the mean NOx levels (in µg m-3) derived from analysis of the DEFRA dataset. This variable rate will provide an economic incentive to the institution to improve air quality. We suppose that the extra funds collected based on this variable rate might be transferred to the agency tasked with improving air quality - a sort of cybernetic control system for adapting government budgeting based on observations of environmental health. We chose not to transfer the additional funds raised to investors because we did not want lenders to profit from degrading air quality. It is worth emphasizing: our aim here is to demonstrate the feasibility of sustainability-linked smart contracts, not to make recommendations about the most appropriate design of these instruments.
For this bond, the Greater London Authority will be required to pay 1 ether for each measured µg m-3 of NOx.
Thus, for the term of 2003-2013, the borrower could expect to see the following dynamics:
year |
noxLevel |
bondsNumber |
parValueEther |
couponRate |
coupon |
totalCoupon |
variablePayment |
totalAnnualPayment |
variableInterestRate |
---|---|---|---|---|---|---|---|---|---|
2003 |
56.15748001 |
1000 |
1 |
0.03 |
0.03 |
30 |
56.15748001 |
86.15748001 |
0.08615748001 |
2004 |
47.48138536 |
1000 |
1 |
0.03 |
0.03 |
30 |
47.48138536 |
77.48138536 |
0.07748138536 |
2005 |
49.60424539 |
1000 |
1 |
0.03 |
0.03 |
30 |
49.60424539 |
79.60424539 |
0.07960424539 |
2006 |
46.74988874 |
1000 |
1 |
0.03 |
0.03 |
30 |
46.74988874 |
76.74988874 |
0.07674988874 |
2007 |
49.84159725 |
1000 |
1 |
0.03 |
0.03 |
30 |
49.84159725 |
79.84159725 |
0.07984159725 |
2008 |
43.85691224 |
1000 |
1 |
0.03 |
0.03 |
30 |
43.85691224 |
73.85691224 |
0.07385691224 |
2009 |
44.05282664 |
1000 |
1 |
0.03 |
0.03 |
30 |
44.05282664 |
74.05282664 |
0.07405282664 |
2010 |
46.70628094 |
1000 |
1 |
0.03 |
0.03 |
30 |
46.70628094 |
76.70628094 |
0.07670628094 |
2011 |
41.34744668 |
1000 |
1 |
0.03 |
0.03 |
30 |
41.34744668 |
71.34744668 |
0.07134744668 |
2012 |
39.26930737 |
1000 |
1 |
0.03 |
0.03 |
30 |
39.26930737 |
69.26930737 |
0.06926930737 |
2013 |
40.30984002 |
1000 |
1 |
0.03 |
0.03 |
30 |
40.30984002 |
70.30984002 |
0.07030984002 |
Summary figures:
Total capital raised | 1000 ether |
Total paid coupons | 330 ether |
Total variable payments | 505.38 ether |
Total repaid | 1835.38 ether |