Join our upcoming webinar 'Learn how to Leverage Plugin APIs on Hyperledger Besu' - February 4, 2020 at 2PM ET

 

December 4, 2019

DCO Sign-Offs: Committing Code to Hyperledger Besu

by, pegasys

This article was written by Felipe Faraggi and originally posted on Kauri.

What is the DCO sign off?

This stack overflow answer does a good job of explaining it:

It was introduced in the wake of the SCO lawsuit […] as a Developers Certificate of Origin. It is used to say that you certify that you have created the patch in question, or that you certify that to the best of your knowledge, it was created under an appropriate open-source license, or that it has been provided to you by someone else under those terms.



The answer also mentions only a few projects use the DCO sign off feature, and well, Hyperledger Besu is one of those projects. Since submitting the Java Ethereum client, formerly known as Pantheon, to the Linux Foundation’s Hyperledger  (where it is now known as Hyperledger Besu), we require contributors to add a line of text essentially signing their comment in order to affirm that the code submitted has originated from themselves (or that they have permission to use it).

If you want to read the contents of the Developer Certificate of Origin, see here: https://developercertificate.org.


How to sign off?

This should be done after following the instructions on how to commit.

There are several ways to add the line “Signed-off-by: Your Legal Name ” to each of your commits.

1. Manually adding it.

You can add this line of text manually to your commit body on each commit. Although cumbersome, it possible and simple.

git commit -m "Fix typo in documentation
Signed-off-by: Legal Name <[email protected]>"

or

git commit -m "Fix typo in documentation" -m "Signed-off-by: Legal Name <[email protected]>"

2. Automating this boring step

Computers can do things for us, so lets configure that.

git config user.name "Legal Name"
git config user.email "[email protected]" 

You can use -global or `-g in order to configure this globally on your machine.

Now all you need to do is add -s or --signoff to your git commit commands.

git commit -s -m "Fix typo in documentation"
  1. Adding it if you forgot to sign-off. If you forgot to add the sign-off, you can also amend your commit with the sign-off.
git commit --amend -s

3. Adding alias

If you’re already added your name and email to the config, you can add an alias to your local setup in order to automatically add that -s t every commit command.

This can be done wither on your local CLI setup, or through a git alias as follows:

git config --global alias.c 'commit --signoff'

And now you can run git commit c -m instead of git commit -s -m.

For an example of the former using zsh:

echo alias gco='git commit -s' >> ~/.zshrc

For bash, replace .zshrc with .bashrc.

If you want to reduce your typing even futher, add the -m flag.

echo alias gco='git commit -s -m' >> ~/.zshrc

Verify that your config was written.

$ tail ~/.zshrc

You should see the following, or similar:

alias gco=git commit -s

In order to test this last option out, you have to re-source the config file:

source ~/.zshrc

For bash, replace .zshrc with .bashrc.

If you’ve already pushed your changes to Github, you will have to force push your branch after this with git push -f.

DCO Errors

For more information on DCO sign-off, including how to deal with DCO errors flagged by our bot, check out Hyperledger’s wiki.

Recent Posts

Key Factors to Consider When Choosing a Blockchain Consensus Protocol

This post was authored by David Hyland-Wood, with input from Roberto Saltini, Franck Cassez, and Joanne Fuller.

A blockchain …

Introducing Plugin APIs in Hyperledger Besu

As part of its 1.4 release (set for February 26), Hyperledger Besu will expose a Plugin API. …

PegaSys in 2020

2019 has come to an end, and we’re already a week into 2020. …